package training.hari.exception;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class ExceptionsDemo {

	
	public void demoCheckedException() throws MyCheckedException {
		
		
			throw new MyCheckedException("this is dummy exception");
		
	}
	
	public void demoUncheckedException(){
		throw new MyUncheckedException("this is dummy unchecked exception");
	}
	
	public static void main(String[] args) {//throws FileNotFoundException {

		int i = 100;
		int j = 0;
		System.out.println("before i/0 ");
		String abc="abc";
		
		
		
			j = i / 0;
		
		System.out.println("after i/0 ");
		System.out.println("i, j values " + i + " , " + j);
		
		
		try {
			FileInputStream input = new FileInputStream("test");
			System.out.println("after input");
		} catch (FileNotFoundException | ArithmeticException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new ArithmeticException();
		}catch(Exception e){
			
		}
		
		ExceptionsDemo demo = new ExceptionsDemo();
		try {
			demo.demoCheckedException();
		} catch (MyCheckedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		finally{
			System.out.println("in the final block");
		}

	}

}
